fix up style file OFIELD option processing.
authortsteven4 <tsteven4@gmail.com>
Thu, 27 Dec 2018 18:38:34 +0000 (11:38 -0700)
committertsteven4 <tsteven4@gmail.com>
Thu, 27 Dec 2018 18:38:34 +0000 (11:38 -0700)
xcsv.cc

diff --git a/xcsv.cc b/xcsv.cc
index 6b3e140a1dd26eaae64efdab6ca5defe3c2d3a08..b1ec2b06eba11f3017e476d2c4ad7cbe2b7a03e8 100644 (file)
--- a/xcsv.cc
+++ b/xcsv.cc
@@ -333,8 +333,10 @@ xcsv_parse_style_line(QString line)
 
     // This is pretty lazy way to parse write options.
     // They've very rarely used, so we'll go for simple.
-    if (tokens.size() > 4) {
-      QString options_string = tokens[3].simplified();
+    // We may have split the optional fourth and final field which can contain
+    // option[s], so look at all the remaining tokens.
+    for (int token_idx = 3; token_idx < tokens.size(); ++token_idx) {
+      QString options_string = tokens[token_idx].simplified();
       if (options_string.contains("no_delim_before")) {
         options |= OPTIONS_NODELIM;
       }